<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
</head>

<body>
<?php include_once('conn.php');?>


<?php 

$from="";
$to= isset($_POST["to"])?make_safe($_POST["to"]):'';
$content=isset($_POST["content"])?make_safe($_POST["content"]):'';
$action=isset($_GET["action"])?make_safe($_GET["action"]):'';
$title=isset($_GET["title"])?make_safe($_GET["title"]):'';
if($title==""){
$title=make_safe($_POST["title"]);
}
$url= isset($_GET["url"])?make_safe($_GET["url"]):'';

if($action=="sent"){
$action=="";
$from=$from;
$to=$to;
$cc=$_POST[cc];
$bcc=$_POST[bcc];
//$title="BIOS Monthly 文章轉寄功能！";
$content="$content</br></br>";

$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=utf-8\r\n";
$headers .= "To: $to\r\n";
$headers .= "From: $from\r\n";
if($cc!="")
 {
  $headers .= "Cc: $cc\r\n"; 
 }
 if($bcc!="")
  {
   $headers .= "Bcc: $bcc\r\n";
  
  }
@mail($to, $title, $content, $headers);
echo "<script> alert('發送成功！');parent.window.location.href='".$url."';</script>";
}
?>




<form name="form1" action="?action=sent&url=<?php echo urlencode($url);?>" method="post">
<div id="article-mail" class="clearfix">
  <div class="article-mail-t1">收件人：
    <label for="textfield"></label>
    <input name="to" type="text" class="article-mail-t11" id="textfield" />
  </div>
  <div class="article-mail-t1">信件主旨：<?php echo $title;?>
    <input type="hidden" name="title" value="<?php echo $title;?>" />
  </div>
  <div class="article-mail-t2">
    <label for="textfield2"></label>
    <textarea name="content" class="article-mail-t22" id="textfield2">推薦你看一篇不錯的文章。 
    <?php echo $title;?>
    http://www.biosmonthly.com/<?php echo $url;?></textarea>
  </div>
  <div class="article-mail-t3">
    <input type="submit" name="Submit" value="發送" />
 </div>
</div>
</form>


</body>
</html>
